home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WCHECKBX.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  4.4 KB  |  157 lines

  1. /*************************************************************************
  2.  *
  3.  * WCheckBox -- Wrapper for the check box control.
  4.  *
  5.  *   Events:
  6.  *
  7.  *       DataAvailable --
  8.  *
  9.  *       DataClose --
  10.  *
  11.  *       DataOpen --
  12.  *
  13.  *       DataRequest --
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WCHECKBX_HPP_INCLUDED
  18. #define _WCHECKBX_HPP_INCLUDED
  19. #pragma once
  20.  
  21. #ifndef _WNO_PRAGMA_PUSH
  22. #pragma pack(push,8);
  23. #pragma enum int;
  24. #endif
  25.  
  26. #ifndef _WBUTTON_HPP_INCLUDED
  27. #  include "wbutton.hpp"
  28. #endif
  29. #ifndef _WDATATRG_HPP_INCLUDED
  30. #  include "wdatatrg.hpp"
  31. #endif
  32.  
  33. class WDataSource;
  34.  
  35. class WCMCLASS WCheckBox : public WButton {
  36.     WDeclareSubclass( WCheckBox, WButton );
  37.     
  38.     public:
  39.  
  40.         /******************************************************
  41.          * Constructors and Destructors
  42.          ******************************************************/
  43.  
  44.         WCheckBox();
  45.     
  46.         ~WCheckBox();
  47.  
  48.         /******************************************************
  49.          * Properties
  50.          ******************************************************/
  51.  
  52.         // Checked
  53.         //
  54.         //     Set/get whether the check box is checked or not.
  55.         //     TRUE means its state is WBStateChecked, FALSE
  56.         //     means it is WBStateNotChecked (or possibly
  57.         //     WBStateIndeterminate for 3-state boxes).  Setting
  58.         //     to FALSE always sets it to WBStateNotChecked.
  59.  
  60.         WBool  GetChecked() const;
  61.         WBool  SetChecked( WBool checked );
  62.  
  63.         // DataColumns
  64.  
  65.         WString GetDataColumns() const;
  66.         WBool   SetDataColumns( const WString & cols );
  67.  
  68.         // DataSource
  69.  
  70.         WDataSource *GetDataSource() const;
  71.         WBool        SetDataSource( WDataSource *source );
  72.  
  73.         // DataValueChecked
  74.  
  75.         WString GetDataValueChecked() const;
  76.         WBool   SetDataValueChecked( const WString & val );
  77.  
  78.         // DataValueUnchecked
  79.  
  80.         WString GetDataValueUnchecked() const;
  81.         WBool   SetDataValueUnchecked( const WString & val );
  82.  
  83.         // FDXDataSource
  84.  
  85.         WBool SetFDXDataSource( WULong * fdxDataSource );
  86.         WBool SetFDXDataSource( WBool * fdxDataSource );
  87.  
  88.         // State
  89.         //
  90.         //     Set/get the check state. 
  91.  
  92.         WButtonState GetState( WBool getAllStates=FALSE ) const;
  93.         WBool        SetState( WButtonState state );
  94.  
  95.         /******************************************************
  96.          * Methods
  97.          ******************************************************/
  98.  
  99.         // Toggle
  100.         //
  101.         //     Toggles the state, returning the new state.  If
  102.         //     a 2-state checkbox, toggles between checked & unchecked.
  103.         //     Otherwise goes unchecked->checked->indeterminate->unchecked.
  104.  
  105.         WButtonState Toggle();
  106.  
  107.         /******************************************************
  108.          * Overrides
  109.          ******************************************************/
  110.  
  111.         virtual WColor GetBackColor( WBool getResultingColor=TRUE ) const;
  112.  
  113.         virtual WBool AutoSize();
  114.  
  115.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  116.                                    void * data=NULL );
  117.     
  118.         virtual const WChar * InitializeClass();
  119.  
  120.         virtual WStyle       GetDefaultStyle() const;
  121.  
  122.         virtual WBool FDXIn();
  123.  
  124.         virtual WBool FDXOut();
  125.  
  126.         virtual WBool ProcessCommand( WUInt id, WNotify code,
  127.                                       WNotifyInfo info, WLong & returns );
  128.  
  129.         WBool DataOpenHandler( WCheckBox *, WDataOpenEventData *ev );
  130.         WBool DataCloseHandler( WCheckBox *, WDataCloseEventData *ev );
  131.         WBool DataAvailableHandler( WCheckBox *, WDataAvailableEventData *ev );
  132.         WBool DataRequestHandler( WCheckBox *, WDataRequestEventData *ev );
  133.  
  134.     protected:
  135.  
  136.         WBool AllocDTCell();
  137.  
  138.         /**************************************************************
  139.          * Data members
  140.          **************************************************************/
  141.  
  142.     protected:
  143.  
  144.         WULong *                _fdxDataSource;
  145.         WBool *                 _fdxDataSourceBool;
  146.         WDataTargetBoolCell *   _dataTarget;
  147.         WButtonState            _initial;
  148.         WBool                   _wasEnabled;
  149. };
  150.  
  151. #ifndef _WNO_PRAGMA_PUSH
  152. #pragma enum pop;
  153. #pragma pack(pop);
  154. #endif
  155.  
  156. #endif // _WCHECKBX_HPP_INCLUDED
  157.